#ifndef CAMERA_H
#define CAMERA_H


#include "stdafx.h"
#include "RenderInterface.h"


#define DEFAULT_NEAR_PLANE 0.001
#define DEFAULT_FAR_PLANE 15
class DecoCamera
{
private:
	Coords coordinate, backupCoord;
	FLOAT viewAngle, aspect, nearDist, farDist, width, height;
	ConvexVolume viewFrustum;
	BOOL bIsOrthognal;
	DecoRenderInterface* RI;

	//void setModelViewMatrix();

public:
	DecoCamera()
	{}
	DecoCamera(DecoRenderInterface *InRI)
	{
		RI = InRI;
	}
	void setRenderInterInterface(DecoRenderInterface *InRI)
	{
		RI = InRI;
	}
	void set (vector3 Eye, vector3 look, vector3 up);
	void roll (FLOAT angle);
	void pitch (FLOAT angle);
	void yaw (FLOAT angle);
	void slide (DOUBLE delX, DOUBLE delY, DOUBLE delZ, BOOL bLocal = FALSE);
	void setFrustum (FLOAT vAng, FLOAT asp, FLOAT nearD, FLOAT farD);
	void setOrtho(FLOAT width, FLOAT height, FLOAT nearD, FLOAT farD);
	vector3 getEye (void);
	void localRotate (FLOAT angle, AXIS axis);
	void globalRotate (FLOAT angle, AXIS axis);
	void lookFromSide(AXIS axis, BOOL positiveDir);
	void walkLeft(FLOAT distance);
	void walkFront(FLOAT distance);
	BOOL isOrthogonal(void) const
	{
		return bIsOrthognal;
	}
	ConvexVolume getViewFrustum();
	FLOAT getVerticalViewAngle(void) const
	{
		return viewAngle;
	}
	FLOAT getNearDistance() const
	{
		return nearDist;
	}
	FLOAT getFarDistance() const
	{
		return farDist;
	}
	FLOAT getWidth() const
	{
		return width;
	}
	FLOAT getHeight() const
	{
		return height;
	}
	void toggoleMode();
	void magnify(FLOAT ratio);
	void reflectXZPlane();
	const Coords& getCoords()const;
	friend DecoArchive& operator<< (DecoArchive& Ar, const DecoCamera& cm);
	friend DecoArchive& operator>> (DecoArchive& Ar, DecoCamera& cm);

};

#endif